package com.situ.day15.db;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class DBTest {

	public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
		// IDB db = new MySql();
		// IDB db = new Oracle();
		// db.getConnection();
		
		FileInputStream fileInputStream =
				new FileInputStream("src/com/situ/day15/db/db.properties");
		Properties properties = new Properties();
		properties.load(fileInputStream);
		String className = (String) properties.get("className");
		Class clazz = Class.forName(className);
		// 对于拿到无参构造方法，然后调用newInstance这个过程，可以简写成下面这种方式
		IDB db = (IDB) clazz.newInstance();
		db.getConnection();
	}
}
